<template>
  <div class="container-content add">
    <el-row>
      <el-col :span="24">
        <h3 class="panel-title">编辑数据</h3>
      </el-col>
    </el-row>
    <!-- <el-divider class="divider"></el-divider> -->
    <el-form
      ref="formObjectRef"
      :model="formObject"
      label-width="80px"
      status-icon
      label-position="left"
    >
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleTabClick"
        class="tabs"
      >
        <el-tab-pane label="工商资质信息" name="first">
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="源单类型">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.receipt"
                  readonly
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="源单编号">
                <el-input
                  readonly
                  v-model="formObject.surveyBaseDataEntity.receiptNumber"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用电企业名称" label-width="100px">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.enterpriseName"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="地区">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.region"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="渠道来源">
                <el-select
                  v-model="formObject.surveyBaseDataEntity.channelSourceValue"
                  placeholder="请选择"
                  style="width: 100%"
                  @change="selectChange"
                >
                  <el-option
                    v-for="item in dataoptions"
                    :key="item.id"
                    :label="item.label"
                    :value="parseInt(item.value)"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="注册资本(万元)" label-width="110px">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.registeredCapital"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="企业性质">
                <!-- <el-input
                  v-model="formObject.surveyBaseDataEntity.enterpriseNature"
                ></el-input> -->
                <el-select
                  v-model="formObject.surveyBaseDataEntity.enterpriseNature"
                  placeholder="请选择"
                  style="width: 100%"
                  value-key="label"
                >
                  <el-option
                    v-for="item in enterpriseNatureOptions"
                    :key="item.id"
                    :label="item.label"
                    :value="parseInt(item.value)"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="路条人">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.refereeId"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="业务员">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.businessUserId"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="屋顶数量">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.number"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="厂房性质">
                <el-checkbox-group
                  v-model="formObject.surveyBaseDataEntity.factoryNature"
                >
                  <el-checkbox
                    v-for="item in factoryNatureOptions"
                    :key="item.value"
                    :label="item.label"
                    v-model="item.value"
                    border
                  >
                    {{ item.label }}</el-checkbox
                  >
                </el-checkbox-group>
              </el-form-item>
            </el-col>

            <el-col>
              <el-form-item label="屋顶类型">
                <el-checkbox-group
                  v-model="formObject.surveyBaseDataEntity.roofType"
                >
                  <el-checkbox
                    v-for="item in roofTypeOptions"
                    :label="item.label"
                    v-model="item.value"
                    border
                    :key="item.value"
                    >{{ item.label }}</el-checkbox
                  >
                </el-checkbox-group>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="屋面防水方式" label-width="110px">
                <el-checkbox-group
                  v-model="formObject.surveyBaseDataEntity.roofWaterproofing"
                >
                  <el-checkbox
                    v-for="item in roofWaterproofingOptions"
                    :label="item.label"
                    v-model="item.value"
                    border
                    :key="item.value"
                    >{{ item.label }}</el-checkbox
                  >
                </el-checkbox-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="产权屋顶面积(平方米)" label-width="160px">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.area"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否漏水">
                <el-radio
                  v-model="formObject.surveyBaseDataEntity.isLeakage"
                  :label="1"
                  border
                  >是</el-radio
                >
                <el-radio
                  v-model="formObject.surveyBaseDataEntity.isLeakage"
                  :label="2"
                  border
                  >否</el-radio
                >
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24">
              <el-form-item label="生产模式">
                <el-input
                  placeholder="说明：工作时间（是否有周末放假等）；上下班事件（二班倒或三班倒几点到几点等）；晚班评价负荷；春节放假情况；春节放假情况；春节放假变压器是否报停"
                  v-model="formObject.surveyBaseDataEntity.proMode"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24" class="tip-input">
              <el-form-item label="企业征信是否合格" label-width="130px">
                <el-radio
                  v-model="formObject.surveyBaseDataEntity.creditQualified"
                  :label="1"
                  border
                  >合格</el-radio
                >
                <el-radio
                  v-model="formObject.surveyBaseDataEntity.creditQualified"
                  :label="2"
                  border
                  >不合格</el-radio
                >
              </el-form-item>
              <p>
                说明：企查查检索记录里，自身风险里有“失信被执行人，或限制高消费”记录，即为“不合格”
              </p>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="项目模式">
                <el-select
                  v-model="formObject.surveyBaseDataEntity.projectModeValue"
                  placeholder="请选择"
                  style="width: 100%"
                  value-key="label"
                >
                  <el-option
                    v-for="item in proModeOptions"
                    :key="item.id"
                    :label="item.label"
                    :value="parseInt(item.value)"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="企业经营地址" label-width="100px">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.address"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="企业所属行业" label-width="100px">
                <el-input
                  v-model="formObject.surveyBaseDataEntity.enterIndustryValue"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="企业有无搬迁计划" label-width="130px">
                <el-radio
                  v-model="
                    formObject.surveyBaseDataEntity.enterRelocationPlanValue
                  "
                  :label="1"
                  border
                  >有</el-radio
                >
                <el-radio
                  v-model="
                    formObject.surveyBaseDataEntity.enterRelocationPlanValue
                  "
                  :label="2"
                  border
                  >无</el-radio
                >
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="计划搬迁日期" label-width="100px">
                <el-date-picker
                  v-model="formObject.surveyBaseDataEntity.relocationTime"
                  type="date"
                  placeholder="选择日期"
                  style="width: 100%"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="是否需要投标" label-width="100px">
                <el-radio
                  v-model="formObject.surveyBaseDataEntity.isTender"
                  :label="1"
                  border
                  >是</el-radio
                >
                <el-radio
                  v-model="formObject.surveyBaseDataEntity.isTender"
                  :label="2"
                  border
                  >否</el-radio
                >
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="电压接入等级" label-width="100px">
                <el-select
                  v-model="formObject.surveyBaseDataEntity.voltageLevelValue"
                  placeholder="请选择"
                  style="width: 100%"
                  value-key="label"
                >
                  <el-option
                    v-for="item in levelOptions"
                    :key="item.id"
                    :label="item.label"
                    :value="parseInt(item.value)"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="备注" label-width="100px">
                <el-input
                  type="textarea"
                  v-model="formObject.surveyBaseDataEntity.remarks"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="用电情况" name="second">
          <div class="desc-title">一自然年每月总用电量(9:00-17：00)万度</div>
          <el-row :gutter="20">
            <el-col :span="4">
              <el-form-item label="一月">
                <el-input
                  v-model="formObject.surveyElectricEntity.januaryNumber"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="二月">
                <el-input
                  v-model="formObject.surveyElectricEntity.februaryNumber"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="三月">
                <el-input
                  v-model="formObject.surveyElectricEntity.marchNumber"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="四月">
                <el-input
                  v-model="formObject.surveyElectricEntity.aprilNumber"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="五月">
                <el-input v-model="formObject.surveyElectricEntity.mayNumber" />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="六月">
                <el-input
                  v-model="formObject.surveyElectricEntity.juneNumber"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="4">
              <el-form-item label="七月">
                <el-input
                  v-model="formObject.surveyElectricEntity.julyNumber"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="八月">
                <el-input
                  v-model="formObject.surveyElectricEntity.augustNumber"
                />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="九月">
                <el-input v-model="formObject.surveyElectricEntity.sepNumber" />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="十月">
                <el-input v-model="formObject.surveyElectricEntity.octNumber" />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="十一月">
                <el-input v-model="formObject.surveyElectricEntity.novNumber" />
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="十二月">
                <el-input v-model="formObject.surveyElectricEntity.decNumber" />
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <el-divider><i class="el-icon-mobile-phone"></i></el-divider> -->
          <!-- <el-divider></el-divider> -->
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="在用变压器数量(台)" label-width="140px">
                <el-input
                  v-model="formObject.surveyElectricEntity.transformerNumber"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="预计电费折扣" label-width="100px">
                <el-input
                  v-model="formObject.surveyElectricEntity.planDiscount"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="光伏发电期间企业电价(元/度)"
                label-width="200px"
              >
                <el-input
                  v-model="formObject.surveyElectricEntity.pvElePrice"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="上网电价">
                <el-input
                  v-model="formObject.surveyElectricEntity.gridElePrice"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="在用变压器容量(kVA)" label-width="150px">
                <el-input
                  v-model="formObject.surveyElectricEntity.transformerCapacity"
                  placeholder="按每台报数(参考格式:xxxkVA+xxxkVA+xxxkVA+...)"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="日照小时数(小时/年)" label-width="145px">
                <el-input
                  v-model="formObject.surveyElectricEntity.pvElePrice"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6">
              <el-form-item label="尖时间段">
                <el-input
                  v-model="formObject.surveyElectricEntity.tipPeriod"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="峰时间段">
                <el-input
                  v-model="formObject.surveyElectricEntity.peakPeriod"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="6">
              <el-form-item label="平时间段">
                <el-input
                  v-model="formObject.surveyElectricEntity.flatPeriod"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="谷时间段">
                <el-input
                  v-model="formObject.surveyElectricEntity.valleyPeriod"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="生产的产品及设备" label-width="136px">
                <el-input
                  v-model="formObject.surveyElectricEntity.proDevice"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="变压器容量" label-width="100px">
                <el-input></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="工作时间">
                <el-input
                  v-model="formObject.surveyElectricEntity.workTime"
                  placeholder="是否有周末放假等"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="上下班时间" label-width="100px">
                <el-input
                  v-model="formObject.surveyElectricEntity.commutingTime"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="白班平均负荷" label-width="100px">
                <el-input
                  v-model="formObject.surveyElectricEntity.dayAvgLoad"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="午休时间、午休平均负荷" label-width="170px">
                <el-input
                  v-model="formObject.surveyElectricEntity.noonAvgLoad"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="晚班平均负荷" label-width="110px">
                <el-input
                  v-model="formObject.surveyElectricEntity.nightAvgLoad"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="春节放假情况" label-width="110px">
                <el-input
                  v-model="formObject.surveyElectricEntity.holidayInfo"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="春节变压器是否报停" label-width="150px">
                <el-radio
                  v-model="formObject.surveyElectricEntity.isHolidayStop"
                  :label="1"
                  border
                  >是</el-radio
                >
                <el-radio
                  v-model="formObject.surveyElectricEntity.isHolidayStop"
                  :label="2"
                  border
                  >否</el-radio
                >
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="可摆放并网柜台数" label-width="135px">
                <el-input
                  v-model="formObject.surveyElectricEntity.gridCabinetNumber"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item
                label="配电室是否有预留间隔，可否容并网柜接入(380V接入)"
                label-width="360px"
              >
                <!-- v-model="formObject.surveyElectricEntity.isHolidayStop" -->
                <el-radio label="1" border>是</el-radio>
                <!-- v-model="formObject.surveyElectricEntity.isHolidayStop" -->
                <el-radio label="2" border>否</el-radio>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="图纸" name="third">
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="总平面图">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="管线图">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="电气图">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="24">
              <el-form-item label="其他信息">
                <el-input type="textarea"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="征信" name="fourth">
          <!-- <div class="desc-title">征信</div> -->
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="材料类型">
                <el-select placeholder="请选择" style="width: 100%">
                  <!-- <el-option
                    v-for="item in fileOptions"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option> -->
                </el-select>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="征信是否合格" label-width="108px">
                <el-radio :label="1" border>合格</el-radio>
                <el-radio :label="2" border>不合格</el-radio>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="备注">
                <el-input type="textarea"></el-input>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="企查查截图" label-width="94px">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="其他附件">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <div class="desc-title">营业执照</div> -->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="营业执照">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <div class="desc-title">不动产权</div> -->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="不动产权">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <div class="desc-title">12月电费单</div> -->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="12月电费单" label-width="95px">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <div class="desc-title">图纸</div> -->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="图纸" label-width="55px">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <div class="desc-title">三年财报</div> -->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="三年财报">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <!-- <div class="desc-title">连续七天用电</div> -->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="连续七天用电" label-width="110px">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :auto-upload="false"
                >
                  <!-- :file-list="fileList" -->
                  <el-button slot="trigger" size="small" type="primary"
                    ><i class="el-icon-plus"></i>添加</el-button
                  >
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
      </el-tabs>
      <el-form-item label-width="0px">
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { editSurvey, getEditSurvey } from "@/api/system/survey";
export default {
  data() {
    return {
      activeName: "first",
      formObject: {
        surveyBaseDataEntity: {
          customerId: "", //客户Id
          receipt: "屋顶方资源收集", //源单类型
          receiptNumber: "", //源单编号
          enterpriseName: "", //企业名称
          enterpriseNature: null, //企业性质
          region: "", //地区
          registeredCapital: "", //注册资本
          channelSourceValue: null, //渠道来源
          businessUserId: "", //业务员
          refereeId: "", //路条人
          roofType: [], //屋顶类型
          factoryNature: [], //厂房性质
          roofWaterproofing: [], //屋面防水方式
          number: "", //屋顶数量
          isLeakage: "", //是否漏水
          creditQualified: "", //征信是否合格
          projectModeValue: null, //项目模式
          address: "", //企业经营地址
          enterIndustryValue: "", //企业所属行业
          enterRelocationPlanValue: "", //企业有无搬迁计划
          relocationTime: "", //计划搬迁日期
          isTender: "", //是否需要投标
          voltageLevelValue: null, //电压接入等级
          remarks: "", //备注
          area: "", //产权屋顶面积(平方米)
          proMode: "", //生产模式
          fileEntities: [], //附件
        },
        surveyElectricEntity: {
          januaryNumber: "", //一月用电
          februaryNumber: "", //二月用电
          marchNumber: "", //三月用电
          aprilNumber: "", //四月用电
          mayNumber: "", //五月用电
          juneNumber: "", //六月用电
          julyNumber: "", //七月用电
          augustNumber: "", //八月用电
          sepNumber: "", //九月用电
          octNumber: "", //十月用电
          novNumber: "", //十一月用电
          decNumber: "", //十二月用电,
          transformerNumber: "", //在用变压器数量
          planDiscount: "", //预计电费折扣
          pvElePrice: "", //光伏发电期间企业电价
          gridElePrice: "", //上网电价
          transformerCapacity: "", //在用变压器容量
          pvElePrice: "", //日照小时数
          tipPeriod: "", //尖时间段
          peakPeriod: "", //峰时间段
          flatPeriod: "", //平时间段
          valleyPeriod: "", //谷时间段
          proDevice: "", //生产的产品及设备
          workTime: "", //工作时间
          commutingTime: "", //上下班时间
          dayAvgLoad: "", //白班平均负荷
          noonAvgLoad: "", //午休平均负荷
          nightAvgLoad: "", //晚班平均负荷
          holidayInfo: "", //春节放假情况
          isHolidayStop: "", //春节变压器是否报停
          gridCabinetNumber: "", //可摆放并网柜数量
        },
      },
      // 项目模式
      proModeOptions: [],
      //电压接入等级
      levelOptions: [],
      //渠道来源
      dataoptions: [],
      //企业性质类型
      enterpriseNatureOptions: [],
      //屋顶类型
      roofTypeOptions: [],
      // 厂房性质
      factoryNatureOptions: [],
      // 屋面防水方式
      roofWaterproofingOptions: [],

      fileOptions: [
        {
          value: "选项1",
          label: "选项1",
        },
        {
          value: "选项2",
          label: "选项2",
        },
      ],
      formObjectRules: [],
    };
  },
  methods: {
    // tab切换事件
    handleTabClick() {},
    handlePreview() {},
    handleRemove() {},
    // 处理回显数据
    handleData(id) {
      getEditSurvey(id).then((res) => {
        let data = res.data;
        if ("surveyBaseDataEntity" in data) {
          Object.keys(data.surveyBaseDataEntity).forEach((item) => {
            this.formObject.surveyBaseDataEntity[item] =
              data.surveyBaseDataEntity[item];
          });
          // // 企业性质
          // if (data.surveyBaseDataEntity.enterpriseNature) {
          //   this.formObject.surveyBaseDataEntity.enterpriseNature =
          //     this.enterpriseNatureOptions.find(
          //       (ele) => ele.value == data.surveyBaseDataEntity.enterpriseNature
          //     ).label;
          // }
          // // 渠道来源;
          // if (data.surveyBaseDataEntity.channelSourceValue) {
          //   this.formObject.surveyBaseDataEntity.channelSourceValue =
          //     this.dataoptions.find(
          //       (ele) =>
          //         ele.value == data.surveyBaseDataEntity.channelSourceValue
          //     ).label;
          // }
          // // 项目模式
          // if (data.surveyBaseDataEntity.projectModeValue) {
          //   this.formObject.surveyBaseDataEntity.projectModeValue =
          //     this.proModeOptions.find(
          //       (ele) => ele.value == data.surveyBaseDataEntity.projectModeValue
          //     ).label;
          // }
          // // 电压接入等级
          // if (data.surveyBaseDataEntity.voltageLevelValue) {
          //   this.formObject.surveyBaseDataEntity.voltageLevelValue =
          //     this.levelOptions.find(
          //       (ele) =>
          //         ele.value == data.surveyBaseDataEntity.voltageLevelValue
          //     ).label;
          // }
        }
        if ("surveyElectricEntity" in data) {
          Object.keys(data.surveyElectricEntity).forEach((item) => {
            this.formObject.surveyElectricEntity[item] =
              data.surveyElectricEntity[item];
          });
        }
      });
    },
    selectChange(value) {
      console.log("value", value);
    },
    // 保存表单
    onSubmit() {
      console.log("this.formObject", this.formObject);
      editSurvey(this.formObject).then((res) => {
        if (res.code === 200) {
          this.$message({
            message: "保存成功",
            type: "success",
          });
          this.$router.push({
            path: "/Survey/Data",
          });
        }
      });
    },

    //获取数据字典
    getSelectOptions() {
      // 项目模式
      this.getDicts("sys_project_mode").then((res) => {
        if (res.code === 200) {
          this.proModeOptions = res.data.map((item) => {
            return {
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
      // 企业性质
      this.getDicts("sys_company_nature").then((res) => {
        if (res.code === 200) {
          this.enterpriseNatureOptions = res.data.map((item) => {
            return {
              id: item.dictSort,
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
      // 渠道来源
      this.getDicts("sys_resource").then((res) => {
        if (res.code === 200) {
          this.dataoptions = res.data.map((item) => {
            return {
              id: item.dictSort,
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
      // 电压接入等级
      this.getDicts("sys_voltage_level").then((res) => {
        if (res.code === 200) {
          this.levelOptions = res.data.map((item) => {
            return {
              id: item.dictSort,
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
      // 屋顶类型
      this.getDicts("erp_roof_type").then((res) => {
        if (res.code === 200) {
          this.roofTypeOptions = res.data.map((item) => {
            return {
              id: item.dictSort,
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
      // 厂房类型 erp_workshop_attr
      this.getDicts("erp_workshop_attr").then((res) => {
        if (res.code === 200) {
          this.factoryNatureOptions = res.data.map((item) => {
            return {
              id: item.dictSort,
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
      // 屋面防水方式 roofWaterproofingOptions
      this.getDicts("erp_water_method").then((res) => {
        if (res.code === 200) {
          this.roofWaterproofingOptions = res.data.map((item) => {
            return {
              id: item.dictSort,
              value: item.dictCode,
              label: item.dictLabel,
            };
          });
        }
      });
    },
    //获取列表数据回显
  },
  created() {
    let id = this.$route.query.id;
    this.getSelectOptions();
    this.handleData(id);
  },
};
</script>
<style lang="scss" scoped>
.divider {
  margin: 0;
}
// .tabs {
//   margin-top: 20px;
// }
.tip-input {
  display: flex;
  align-items: flex-start;
  p {
    margin: 10px 20px;
    color: #c0c4cc;
    font-size: 14px;
  }
}
</style>
